package com.dongdongshop.consumer;

import com.alibaba.dubbo.config.annotation.Reference;
import com.dongdongshop.service.ItemPageService;
import org.apache.rocketmq.spring.annotation.MessageModel;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

@Component
@RocketMQMessageListener(topic = "ddItemPage",consumerGroup = "dd", messageModel = MessageModel.BROADCASTING)
public class ItemPageMq implements RocketMQListener<Long[]> {

    private static final Logger logger = LoggerFactory.getLogger(ItemPageMq.class);

    @Reference
    private ItemPageService itemPageService;

    @Override
    public void onMessage(Long[] longs) {
        itemPageService.getItemPage(longs);
        logger.info("消费成功");
    }
}
